#include "widget.h"
#include "ui_widget.h"
#include <QDebug>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    connect(ui->pushButton, &QPushButton::clicked, this, &Widget::handleClicked);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::handleClicked()
{
    this->setWindowTitle("将窗口标题设置为窗口标题1");
    qDebug() << "handleClicked";

}

void Widget::handleClicked2()
{
    this->setWindowTitle("将窗口标题设置为窗口标题2");
    qDebug() << "handleClicked2";
}

void Widget::on_pushButton_2_clicked()
{
    disconnect(ui->pushButton, &QPushButton::clicked, this, &Widget::handleClicked);
    connect(ui->pushButton, &QPushButton::clicked, this, &Widget::handleClicked2);

}

